#ifndef LRCPAGE_H
#define LRCPAGE_H

#include <QWidget>
#include<QPropertyAnimation>

namespace Ui {
class LrcPage;
}

//每行歌词对应的时间和文本
struct LrcLine
{
    qint64 time;
    QString text;
    LrcLine(qint64 time,QString text)
    {
        this->text = text;
        this->time = time;
    }
};

class LrcPage : public QWidget
{
    Q_OBJECT

public:
    explicit LrcPage(QWidget *parent = nullptr);
    ~LrcPage();

    //解析lrc文件
    bool parseLrc(const QString& lrcPath);

    //获取索引
    int getLineLrcWordIndex(qint64 pos);
    QString getLineLrcWord(qint64 index);
    void showLrcWord(int time);

    //头部信息获取
    void setHeadInfo(const QString& musicNmae,const QString& musicSinger);


private:
    Ui::LrcPage *ui;

    QPropertyAnimation* hideAnimal;

    QVector<LrcLine> lrcLines; //按照时间的先后顺序保存每行歌词
};

#endif // LRCPAGE_H
